<?php

/**
 * Created by PhpStorm.
 * User: 建名
 * Date: 2015/12/17
 * Time: 17:17
 */

namespace app\api\controllers;


use yii\web\Controller;
use app\api\Response;
use yii\helpers\ArrayHelper;
use app\models\GkyWeArticle;
use app\models\GkyJiaocai;
class JiaocaiController extends Controller {

    public function actionJiaocai($pageNow, $pageSize) {
//       echo "a";
        $list = GkyJiaocai::jiaocai($pageNow, $pageSize);
        Response::setHeader();
        echo json_encode(ArrayHelper::toArray($list));
    }
    
      public function actionDetail($id){

        $detail = GkyJiaocai::findOne(['id'=>$id]);
        Response::setHeader();
        echo json_encode(ArrayHelper::toArray($detail));
    }
      /**
     * 搜索功能
     * @param type $lwname
     * @return type
     */
    public function actionSearch($jiaocai_name) {
        $lwnames=  GkyJiaocai::find()
//              ->where(['like','jiaocai_name',$jiaocai_name])
                 ->where(['or',['like','jiaocai_name',$jiaocai_name],['like','name',$jiaocai_name]])
              ->all();
      Response::setHeader();
      return json_encode(\yii\helpers\ArrayHelper::toArray($lwnames));
    }
    
      public function actionJiaogailunwen($pageNow, $pageSize) {
//       echo "a";
        $list = \app\models\GkyJiaogaiLunwen::jiaogailunwen($pageNow, $pageSize);
        Response::setHeader();
        echo json_encode(ArrayHelper::toArray($list));
    }
    
      public function actionJiaogaidetail($id){

        $detail =\app\models\GkyJiaogaiLunwen::findOne(['id'=>$id]);
        Response::setHeader();
        echo json_encode(ArrayHelper::toArray($detail));
    }
      /**
     * 搜索功能
     * @param type $lwname
     * @return type
     */
    public function actionJiaogailunwensearch($lunwen_name) {
        $lwnames=  \app\models\GkyJiaogaiLunwen::find()
//              ->where(['like','lunwen_name',$lunwen_name])
                 ->where(['or',['like','lunwen_name',$lunwen_name],['like','name',$lunwen_name]])
              ->all();
      Response::setHeader();
      return json_encode(\yii\helpers\ArrayHelper::toArray($lwnames));
    }
    
      public function actionJiaogaiketi($pageNow, $pageSize) {
//       echo "a";
        $list = \app\models\GkyJiaocaiKeti::jiaogaiketi($pageNow, $pageSize);
        Response::setHeader();
        echo json_encode(ArrayHelper::toArray($list));
    }
    
      public function actionJiaogaiketidetail($id){

        $detail =\app\models\GkyJiaocaiKeti::findOne(['id'=>$id]);
        Response::setHeader();
        echo json_encode(ArrayHelper::toArray($detail));
    }
      /**
     * 搜索功能
     * @param type $lwname
     * @return type
     */
    public function actionJiaogaiketisearch($lunwen_name) {
        $lwnames=  \app\models\GkyJiaocaiKeti::find()
//              ->where(['like','jiaogaiketi_name',$lunwen_name])
                 ->where(['or',['like','jiaogaiketi_name',$lunwen_name],['like','name',$lunwen_name]])
                 ->all();
        
      Response::setHeader();
      return json_encode(\yii\helpers\ArrayHelper::toArray($lwnames));
    }
    
     public function actionJiaoxuehuojiang($pageNow, $pageSize) {
//       echo "a";
        $list = \app\models\GkyJiaoxueHuojiang::jiaoxuehuojiang($pageNow, $pageSize);
        Response::setHeader();
        echo json_encode(ArrayHelper::toArray($list));
    }
    
      public function actionJiaoxuehuojiangdetail($id){

        $detail =  \app\models\GkyJiaoxueHuojiang::findOne(['id'=>$id]);
        Response::setHeader();
        echo json_encode(ArrayHelper::toArray($detail));
    }
      /**
     * 搜索功能
     * @param type $lwname
     * @return type
     */
    public function actionJiaoxuehuojiangsearch($lunwen_name) {
        $lwnames=  \app\models\GkyJiaoxueHuojiang::find()
//              ->where(['like','jiangxiang_name',$lunwen_name])
               ->where(['or',['like','jiangxiang_name',$lunwen_name],['like','name',$lunwen_name]])
              ->all();
      Response::setHeader();
      return json_encode(\yii\helpers\ArrayHelper::toArray($lwnames));
    }
     public function actionJingpinkecheng($pageNow, $pageSize) {
//       echo "a";
        $list = \app\models\GkyJingpinKecheng::jingpinkecheng($pageNow, $pageSize);
        Response::setHeader();
        echo json_encode(ArrayHelper::toArray($list));
    }
    
      public function actionJingpinkechengdetail($id){

        $detail =  \app\models\GkyJingpinKecheng::findOne(['id'=>$id]);
        Response::setHeader();
        echo json_encode(ArrayHelper::toArray($detail));
    }
      /**
     * 搜索功能
     * @param type $lwname
     * @return type
     */
    public function actionJingpinkechengsearch($lunwen_name) {
        $lwnames=  \app\models\GkyJingpinKecheng::find()
//              ->where(['like','kecheng_name',$lunwen_name])
              ->where(['or',['like','kecheng_name',$lunwen_name],['like','name',$lunwen_name]])
              ->all();
      Response::setHeader();
      return json_encode(\yii\helpers\ArrayHelper::toArray($lwnames));
    }
      public function actionJingsai($pageNow, $pageSize) {
//       echo "a";
        $list = \app\models\GkyXueshengJingsai::jingsai($pageNow, $pageSize);
        Response::setHeader();
        echo json_encode(ArrayHelper::toArray($list));
    }
    
      public function actionJingsaidetail($id){

        $detail = \app\models\GkyXueshengJingsai::findOne(['id'=>$id]);
        Response::setHeader();
        echo json_encode(ArrayHelper::toArray($detail));
    }
      /**
     * 搜索功能
     * @param type $lwname
     * @return type
     */
    public function actionJingsaisearch($lunwen_name) {
        $lwnames= \app\models\GkyXueshengJingsai::find()
//              ->where(['like','saixiang_name',$lunwen_name])
              ->where(['or',['like','saixiang_name',$lunwen_name],['like','name',$lunwen_name]])
              ->all();
      Response::setHeader();
      return json_encode(\yii\helpers\ArrayHelper::toArray($lwnames));
    }
      public function actionXiangmu($pageNow, $pageSize) {
//       echo "a";
        $list = \app\models\GkyChuangxinChuangye::xiangmu($pageNow, $pageSize);
        Response::setHeader();
        echo json_encode(ArrayHelper::toArray($list));
    }
    
      public function actionXiangmudetail($id){

        $detail = \app\models\GkyChuangxinChuangye::findOne(['id'=>$id]);
        Response::setHeader();
        echo json_encode(ArrayHelper::toArray($detail));
    }
      /**
     * 搜索功能
     * @param type $lwname
     * @return type
     */
    public function actionXiangmusearch($lunwen_name) {
        $lwnames= \app\models\GkyChuangxinChuangye::find()
//              ->where(['like','xiangmu_name',$lunwen_name])
              ->where(['or',['like','xiangmu_name',$lunwen_name],['like','name',$lunwen_name]])
              ->all();
      Response::setHeader();
      return json_encode(\yii\helpers\ArrayHelper::toArray($lwnames));
    }
    
}